<%# locals: (f:, field:, locale:) %>

<%
  parent = f.object.parent

  base_permalink = parent.present? ? parent.send(field).to_s + "/" : ""
  value = f.object.send(field)&.delete_prefix(base_permalink)

  base_permalink_translated = parent.present? ? I18n.with_locale(locale) { parent.send(field) } + "/" : ""
  translated_value = f.object.send("#{field}_#{locale}")&.delete_prefix(base_permalink_translated)
%>

<%= f.spree_text_field "#{field}_#{locale}", label: Spree.t(field), value: translated_value, prepend: base_permalink_translated.presence %>
